home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / mkmf / mkmf.biglibtop < prev    next >
Encoding:
Text File  |  1991-04-11  |  1.8 KB  |  67 lines

  1. #!/sprite/cmds/csh -f
  2. #
  3. # A script to generate (or regenerate) a Makefile for the topmost directory
  4. # of a library that is divided up into subdirectories.  This direcctory is
  5. # little more than a container for lots of subdirectories that have the
  6. # interesting stuff in them.
  7. #
  8. # We assume we were invoked from mkmf.
  9. #
  10. # Parameters passed in from mkmf as environment variables:
  11. #
  12. #    MKMFDIR        directory containing prototype makefiles
  13. #    MAKEFILE    name of makefile to create
  14. #    MACHINES    list of machine names (e.g. "sun2 sun3"), for
  15. #            which there are machine-dependent subdirectories
  16. #            (sun3.md, spur.md, etc.) of this directory.
  17. #    SUBTYPE        what sort of library this is:  "sprite", "x", etc.
  18. #            Used to determine where to install things.
  19. #
  20. # $Header: /sprite/lib/mkmf/RCS/mkmf.biglibtop,v 1.8 91/04/11 12:53:33 kupfer Exp $ (SPRITE) Berkeley
  21. #
  22.  
  23. #
  24. # Argument processing.  (Generalized form, even though just one flag so far.)
  25. #
  26. while ($#argv >= 1)
  27.     if ("$1" == '-x') then
  28.     set echo
  29.     endif
  30.     shift
  31. end
  32.  
  33. set subtype=$SUBTYPE
  34. set lib=$cwd:t
  35. set machines=($MACHINES)
  36. set makefile=$MAKEFILE
  37. set distdir=($DISTDIR)
  38.  
  39. if (-e $makefile.proto) then
  40.     set proto=$makefile.proto
  41. else
  42.     set proto="${MKMFDIR}/Makefile.biglibtop"
  43. endif
  44.  
  45. echo "Generating $makefile for $cwd using $proto"
  46.  
  47. set subDirs="`find * -type d ! -name \*.md ! -name RCS -prune -print`"
  48. if ("$subDirs" == "") then
  49.     echo "No subdirectories found."
  50. endif
  51.  
  52. set nonomatch
  53. set manPages = (*.man)
  54. if ("$manPages" == "*.man") set manPages=()
  55.  
  56. cat $proto | sed \
  57.     -e "s,@(DATE),`date`,g" \
  58.     -e "s,@(MAKEFILE),$makefile,g" \
  59.     -e "s,@(MANPAGES),$manPages,g" \
  60.     -e "s,@(MACHINES),$machines,g" \
  61.     -e "s,@(NAME),$lib,g" \
  62.     -e "s,@(SUBDIRS),$subDirs,g" \
  63.     -e "s,@(TEMPLATE),$proto,g" \
  64.     -e "s,@(TYPE),$subtype,g" \
  65.     -e "s,@(DISTDIR),$distdir,g" \
  66.     > $makefile
  67.